{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 4b. Calculate solubility constants\n", "\n", "This allows you to calculate the solubility constants for all volatile-bearing melt species in the CHOSX system at a given *P*, *T*, and melt composition.\n", "\n", "It can be run for multiple sets of conditions defined in the input data frame or loaded from a csv file." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python set-up\n", "You need to install VolFe once on your machine, if you haven't yet. Then we need to import a few Python packages (including VolFe). " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Install VolFe on your machine. Don't remove the # from this line!\n", "# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.\n", "\n", "# import python packages\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import VolFe as vf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the inputs\n", "\n", "This example is for a single set of conditions defined in a dataframe.\n", "\n", "This composition is from Brounce et al. (2014) with the updated Fe3+/FeT from Cottrell et al. (2021)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Define the melt composition, fO2 estimate, and T as a dictionary.\n", "my_analysis = {'Sample':'Sari15-04-33',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'P_bar': 1000., # Pressure in bar\n", " 'SiO2': 47.89, # wt%\n", " 'TiO2': 0.75, # wt%\n", " 'Al2O3': 16.74, # wt%\n", " 'FeOT': 9.43, # wt%\n", " 'MnO': 0.18, # wt%\n", " 'MgO': 5.92, # wt%\n", " 'CaO': 11.58, # wt%\n", " 'Na2O': 2.14, # wt%\n", " 'K2O': 0.63, # wt%\n", " 'P2O5': 0.17, # wt%\n", " 'H2O': 4.17, # wt%\n", " 'CO2ppm': 1487., # ppm\n", " 'STppm': 1343.5, # ppm\n", " 'Xppm': 0., # ppm\n", " 'Fe3FeT': 0.177}\n", "\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We'll use the default options" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[78 rows x 1 columns]\n" ] } ], "source": [ "# print default options in VolFe\n", "print(vf.default_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run the calculation\n", "\n", "And this runs the calculation" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Sample | \n", "Pressure (bar) | \n", "T ('C) | \n", "SiO2 | \n", "TiO2 | \n", "Al2O3 | \n", "FeOT | \n", "MnO | \n", "MgO | \n", "CaO | \n", "... | \n", "hydrogen opt | \n", "sulfide opt | \n", "sulfate opt | \n", "hydrogen sulfide opt | \n", "methane opt | \n", "carbon monoxide opt | \n", "species X solubility opt | \n", "Cspeccomp opt | \n", "Hspeccomp opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "Sari15-04-33 | \n", "1000.0 | \n", "1200.0 | \n", "47.948689 | \n", "0.750919 | \n", "16.760515 | \n", "9.441557 | \n", "0.180221 | \n", "5.927255 | \n", "11.594191 | \n", "... | \n", "Basalt_Hughes24 | \n", "ONeill21dil | \n", "ONeill22dil | \n", "Basalt_Hughes24 | \n", "Basalt_Ardia13 | \n", "Basalt_Hughes24 | \n", "Ar_Basalt_HughesIP | \n", "Basalt | \n", "MORB_HughesIP | \n", "2025-02-02 10:19:37.073547 | \n", "
1 rows × 45 columns
\n", "